//超声波
const int Fa_Pin = 2;
const int Jie_Pin = 3;
float pos = 0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(Fa_Pin, OUTPUT);
  pinMode(Jie_Pin, INPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(Fa_Pin, LOW);

  delayMicroseconds(5);

  digitalWrite(Fa_Pin, HIGH);
  delayMicroseconds(12);
  digitalWrite(Fa_Pin, LOW);

  pos = pulseIn(Jie_Pin, HIGH) * 0.01715;
  Serial.println((String)pos + "cm");
  delay(1000);
}
